UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rrgw102nlsAefC7FDqgXnomHFlMPk79FGYZYwzE0ITo=' 
WHERE 
  key_id = '8813646007f741a8c6c175ad2cafb2977f8ff95406e548089b0a954f992942b7' 
  AND (
    token = 'rrgw102nlsAefC7FDqgXnomHFlMPk79FGYZYwzE0ITo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042