UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dW1DaOuIuBKNltpYGIkRr1LKBd+8VlmuxsCywXomQFU=' 
WHERE 
  key_id = 'c64ab2f45255b155a56ca75f91e0432ea94bca433a0a0a6f013ea30ca7e8e1be' 
  AND (
    token = 'dW1DaOuIuBKNltpYGIkRr1LKBd+8VlmuxsCywXomQFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042