UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BLnFH1/NAnAfHW4Rv2g2avyKCGbz2OXJ0fXMkNm8bQ8=' 
WHERE 
  key_id = '6d10d0e96599cf164dcafdca49b0c329e52b47b7008958268ce67ba7f7e69a30' 
  AND (
    token = 'BLnFH1/NAnAfHW4Rv2g2avyKCGbz2OXJ0fXMkNm8bQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039