UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y4RrJC+fe+905BuIS1Wvk75xHh2YlLs5BaDQhnIxEAQ=' 
WHERE 
  key_id = '13b1594c0d91adba34e2243029c637484c11f83f92c0eec6080a212ee58d4ad2' 
  AND (
    token = 'y4RrJC+fe+905BuIS1Wvk75xHh2YlLs5BaDQhnIxEAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041