UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rx3twxv2lJQ7bgodjNIKVTVOUy8NoWZVVot4qraeHTw=' 
WHERE 
  key_id = '0085212a49aaf2128754d451763ccbcf2e022d974445e703563380fceece3550' 
  AND (
    token = 'Rx3twxv2lJQ7bgodjNIKVTVOUy8NoWZVVot4qraeHTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019