UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BC1/yjs8hWdMYPS0Q8TrSySlYasI377FiS95tv+1rOM=' 
WHERE 
  key_id = '081a1d3ce261c86b81df132804eafe78989c0949ddaa27113425dd7e556ba8e1' 
  AND (
    token = 'BC1/yjs8hWdMYPS0Q8TrSySlYasI377FiS95tv+1rOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034