UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'it3PhRTu3ROopk873T9OnhmkfkCHKNiGBrMs66FWFUw=' 
WHERE 
  key_id = '5d6046def596bba121459f94fb1da3bf6c2e2681d0440ec49cab9d14dfd276d3' 
  AND (
    token = 'it3PhRTu3ROopk873T9OnhmkfkCHKNiGBrMs66FWFUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030