UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NkoiWpT5Yf1CsS1EsWuRsALs/aL28FfJu1OQ5zlzwiw=' 
WHERE 
  key_id = '40a436a74781930254f442cd79a8657d811e5ad40f34e1df9ad327e08aa6ff93' 
  AND (
    token = 'NkoiWpT5Yf1CsS1EsWuRsALs/aL28FfJu1OQ5zlzwiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024