UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'apkhX4S1uWtTgfJv+2EXSR0fKsk4NAwlBzzmNqqfTFA=' 
WHERE 
  key_id = 'a8c4e977d75254473312d0dc7b8bd02c416a6360a366333ba54e56e1d1fa2432' 
  AND (
    token = 'apkhX4S1uWtTgfJv+2EXSR0fKsk4NAwlBzzmNqqfTFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037