UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2Q72N+c+xVaTY2w2KZyPjAoWiY2/JgTaP5Ar9tNAPA=' 
WHERE 
  key_id = '0863a68d0675d467b0601cf072432899189b3d91f86a986438e8bf6e48f59c5d' 
  AND (
    token = 'w2Q72N+c+xVaTY2w2KZyPjAoWiY2/JgTaP5Ar9tNAPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030