UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U8qDwP442tkbjB6/cL+FNVKtLDxdl9oVy2ZjN/JrS5c=' 
WHERE 
  key_id = '5ed11f1fd3f814e80d2b2aeda889be68408fa983f74f0be50093ca3efc196c8f' 
  AND (
    token = 'U8qDwP442tkbjB6/cL+FNVKtLDxdl9oVy2ZjN/JrS5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053