UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R7B+Xiig0uSj8qcLJ0HTgGhmrOLy41OoDgn16rVtHAw=' 
WHERE 
  key_id = '5e013d249a327111b6b8ee9cf04a5895d53e343c1a76618de83d4b28b1d1a674' 
  AND (
    token = 'R7B+Xiig0uSj8qcLJ0HTgGhmrOLy41OoDgn16rVtHAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026