UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zj8CQ4BdNBhk0ZprdG98qXLrXLqibkwiCbzLF5W/YHM=' 
WHERE 
  key_id = '618f2e986296b39728524d672b4643df6e510bab3b2bf8040578aa0d0b9c2066' 
  AND (
    token = 'zj8CQ4BdNBhk0ZprdG98qXLrXLqibkwiCbzLF5W/YHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032