UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y6LS9TmpeUlT88rw44tpwz31x6xef7MR0hz5NR64B4k=' 
WHERE 
  key_id = '7c2a20f063dd8b70710056228c3a1d3cfa761f2be8359c015fc9a38a2d93dd76' 
  AND (
    token = 'Y6LS9TmpeUlT88rw44tpwz31x6xef7MR0hz5NR64B4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023