UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6hSYdmSKG1rpaNOH+BUhJbkMGYw7mR04f1260i0Rp0=' 
WHERE 
  key_id = '1781288ec26831019a68cade595732a8fc92710effa479a502805698fcc9b120' 
  AND (
    token = 'G6hSYdmSKG1rpaNOH+BUhJbkMGYw7mR04f1260i0Rp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041