UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1GjLz6s+G48bT7Sx44MAl1qhifwBpoW1nKqx775kHiA=' 
WHERE 
  key_id = '2734cd88fb4d02a83cd45059b3a05b91537b18a3f22863a54b670b29b11d5ba3' 
  AND (
    token = '1GjLz6s+G48bT7Sx44MAl1qhifwBpoW1nKqx775kHiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031