UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kdGhedezEToL4bijI1JGla61B4pxHoJNrC7lz+XyArI=' 
WHERE 
  key_id = '56126f5e96081eb0068d6037c40fc710dc5a3959a915794f8fe4b0d5e35eb267' 
  AND (
    token = 'kdGhedezEToL4bijI1JGla61B4pxHoJNrC7lz+XyArI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028