UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qyoh0Q86KnuyxoFMzDIwMkcNah4Zi1y6Ut6mrua0cLk=' 
WHERE 
  key_id = '167ee439be386a8707adf9b9079164b8cfe7ce466028eb4e2c3aad135a5d822f' 
  AND (
    token = 'Qyoh0Q86KnuyxoFMzDIwMkcNah4Zi1y6Ut6mrua0cLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048