UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1xhBo52rg/c4nkq32ZHkdUrPNceR47qLv/UV+xBHvE=' 
WHERE 
  key_id = '4ca115909aee0c84699e3d1fae32509b460f53de52b752b9e57d31a96878d3fd' 
  AND (
    token = 'e1xhBo52rg/c4nkq32ZHkdUrPNceR47qLv/UV+xBHvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038