UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6b+iC909WqVV8A2VdJMLSKpiszvlh7+b8pcYgQXUSGk=' 
WHERE 
  key_id = '3da2c2bddcd8be2795d475371e91c3df92668ce2d8948ba499664bf414ce3170' 
  AND (
    token = '6b+iC909WqVV8A2VdJMLSKpiszvlh7+b8pcYgQXUSGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060