UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rLNTIYgJBNkTvHVNJ4Oy7gRO9UDFay3IEN3FJ2tpKso=' 
WHERE 
  key_id = 'c80b67e06886779aecbb44ecbfa05b52aaa3e53598040f6f025ec233f2e2ff7e' 
  AND (
    token = 'rLNTIYgJBNkTvHVNJ4Oy7gRO9UDFay3IEN3FJ2tpKso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019