UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k5987zyk4S278kUy8wqkH9/I6nwP6A4wosPJr9se78s=' 
WHERE 
  key_id = 'd5462a4f177d7d29c22c6497ced7619a515052f233ef5429536c9734efcbd77c' 
  AND (
    token = 'k5987zyk4S278kUy8wqkH9/I6nwP6A4wosPJr9se78s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032