UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhkOTFImQmygq1MdnQr6eFMT177LbKcTTjtwh2uieNQ=' 
WHERE 
  key_id = 'e3c326f5eec0438a75fa5ce74d6f73d3bcedd88ea2fef9e9fd9727c546623bad' 
  AND (
    token = 'fhkOTFImQmygq1MdnQr6eFMT177LbKcTTjtwh2uieNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033