UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jufMwrvr9g4WAMwgyIUam1xdy828JsUkzhWi3d1B1NY=' 
WHERE 
  key_id = '630b42597daeb2d479f7e3d384fa17a30f03d9b73e729b56acdbe555eaf02245' 
  AND (
    token = 'jufMwrvr9g4WAMwgyIUam1xdy828JsUkzhWi3d1B1NY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039