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

Query time 0.00041