UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4QSgYILwtgACcCJEfBTUjybrURhjTWfLeAuCbMZZRWU=' 
WHERE 
  key_id = '6f290f5e651625149f08461a491f782419bc5979bfec91df13bbd5cfe4d5ee6b' 
  AND (
    token = '4QSgYILwtgACcCJEfBTUjybrURhjTWfLeAuCbMZZRWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038