UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PgL29cfFjJBl0G11fEdYekagv51Mh7dXPfxGK2M7qIQ=' 
WHERE 
  key_id = '3dfb11402df1528c1e508a77edb1b19b4360fc0d450dbd48a21f51f672aa83bb' 
  AND (
    token = 'PgL29cfFjJBl0G11fEdYekagv51Mh7dXPfxGK2M7qIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037