UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V2YjzsWWdrP9bvOwFRw10E3TDvQr1YFKyVqlzoDoD8Q=' 
WHERE 
  key_id = '5308461386b460dcb1efcbffa3d347482ef00bc120b9a2c4accd96c4d59a5e5e' 
  AND (
    token = 'V2YjzsWWdrP9bvOwFRw10E3TDvQr1YFKyVqlzoDoD8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044