UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eTZYjh+0qb8mtD8mp2qSO7HNxN97HvQvxrrIVJBQ+tU=' 
WHERE 
  key_id = '924c447ba78cf916325b6064f46311665075d78a25f5fe2d7f027dcbb6b81786' 
  AND (
    token = 'eTZYjh+0qb8mtD8mp2qSO7HNxN97HvQvxrrIVJBQ+tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035