UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rtvjj4G7ljgQUzZPwfPZ0JpiokK8mMGs7a84n0dMlDE=' 
WHERE 
  key_id = '337a20582d7948af66639fe40598cf4bf83c9c937004c2a0e91f480ad31afa89' 
  AND (
    token = 'Rtvjj4G7ljgQUzZPwfPZ0JpiokK8mMGs7a84n0dMlDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045