UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd2SxEVOHTlh+VHVtNG0kz/v5s/t1m69tzDFR+P+XJEw=' 
WHERE 
  key_id = 'aec1129178719ef3f2e6a33f798feb95f685694dbfb0e03c51bba7b988ce2920' 
  AND (
    token = 'd2SxEVOHTlh+VHVtNG0kz/v5s/t1m69tzDFR+P+XJEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037