UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '48tOjsXUj6GOP7dDHr32d7UIoqFbZzOHMMur53ohOWQ=' 
WHERE 
  key_id = '09a92793f0c9d299e8c817e1fd71e6f54496a9ff8ce5aa225cf5d6b96d5a3ee6' 
  AND (
    token = '48tOjsXUj6GOP7dDHr32d7UIoqFbZzOHMMur53ohOWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029