UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rCtGYt+bDGO2Yq6XlwNnYBWcfKQmODjBdWYX20GlsOw=' 
WHERE 
  key_id = 'a86e29b63cf7268e344456f1bd699f838c138f9d1a3cff111df5eacd06d60281' 
  AND (
    token = 'rCtGYt+bDGO2Yq6XlwNnYBWcfKQmODjBdWYX20GlsOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046