UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q3j9l32bsDbaM52Ho2kcUU0Wvm6OTuz+dLf5YjJ58SY=' 
WHERE 
  key_id = 'c57bc97c2f4e9cab2705a19532feb51c16142d8e89bb9f394c0033d9a8055dc0' 
  AND (
    token = 'q3j9l32bsDbaM52Ho2kcUU0Wvm6OTuz+dLf5YjJ58SY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072